<template>
	<view class="columnbox wdh-100 content">
		<template v-if="status.msg!='审核成功'">
			<button v-if="status.msg=='审核中'" @click="showStatus">查看详情</button>
			<button v-else-if="status.msg=='审核成功'" @click="showStatus">查看详情</button>
			<button v-else-if="status.msg=='已提交'" @click="showStatus">查看详情</button>
			<button v-else-if="status.msg=='审核失败'" @click="showStatus">查看详情</button>
			<button v-else @click="addApply">申请加盟</button>
		</template>
		<template v-else>
			<view class="rowbox  spb one-info">
				<view>加盟类型</view>
				<view v-if="joininfo.joinType==0">同盟</view>
				<view v-else-if="joininfo.joinType==1">加盟</view>
			</view>
			<view class="rowbox  spb one-info">
				<view>投资金额</view>
				<view v-if="joininfo.joinCash==0">10~20万</view>
				<view v-else-if="joininfo.joinCash==1">20~30万</view>
				<view v-else-if="joininfo.joinCash==2">30~50万</view>
			</view>
			<view class="rowbox  spb one-info">
				<view>洗车形式</view>
				<view v-if="joininfo.stationType==0">旗舰站</view>
				<view v-else-if="joininfo.stationType==1">标准站</view>
				<view v-else-if="joininfo.stationType==2">自助站</view>
				<view v-else-if="joininfo.stationType==3">自动站</view>
			</view>
			<view class="rowbox  spb one-info">
				<view>加盟城市</view>
				<view>{{joininfo.cityName}}</view>
			</view>
			<view class="rowbox  spb one-info">
				<view>联系人</view>
				<view>{{joininfo.contact}}</view>
			</view>
			<view class="rowbox  spb one-info line-box">
				<view>联系方式</view>
				<view>{{joininfo.phone}}</view>
			</view>
			<view class="rowbox  spb one-info">
				<view>加盟进度</view>
				<view v-if="joininfo.verifyType==0">提交审核</view>
				<view v-else-if="joininfo.verifyType==1">审核中</view>
				<view v-else-if="joininfo.verifyType==2">审核失败</view>
				<view v-else-if="joininfo.verifyType==3">审核成功</view>
			</view>
			<view class="rowbox  spb one-info">
				<view>提交时间</view>
				<view>{{joininfo.createTime}}</view>
			</view>
			<!-- 审核成功添加洗车站 -->
			<view v-if="joininfo.verifyType==3" class="small-btn one-btn" @click="addStation">前往添加洗车站</view>
		</template>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				status: '',
				joininfo: ''
			};
		},
		onShow() {
			this.getStatus()
		},
		methods: {
			getStatus() {
				this.$req.get('/xcx/join/record').then(res => {
					this.status = res.data
					if (res.data.msg == '审核成功') {
						this.$req.get(`/xcx/join/${res.data.data}`).then(res => {
							this.joininfo = res.data.data
						})
					} else if (res.data.msg == '未提交') {
						uni.redirectTo({
							url: '/packageA/jiameng/apply'
						})
					}
				})
			},
			addApply() {
				uni.navigateTo({
					url: './apply'
				})
			},
			showStatus() {
				uni.navigateTo({
					url: './applyResult?id=' + this.status.data
				})
			},
			addStation() {
				uni.redirectTo({
					url: '/packageA/xichezhan/add'
				})
			}
		}
	}
</script>
<style lang="scss" scoped>
	.content {
		font-family: PingFang SC;
	}

	.one-info {
		width: 710rpx;
		padding: 32rpx 20rpx;

		font-size: 28rpx;
	}

	.line-box {
		border-bottom: #eef0f7 solid 1px;
	}

	.one-btn {
		width: 710rpx;
		height: 90rpx;
		margin-top: 40rpx;
		border-radius: 20rpx;
	}
</style>